<template>
    <div class="form-group">
        <label class="col-sm-4 control-label"><i class="colorRed">*</i> 选择派单人：</label>
        <div class="col-sm-8">
            <select class="form-control select2" style="width: 100%;"  @change="$emit('input', $event.target.value)">
                <option value="" disabled selected style='display:none;'>请选择</option>
                <option v-for="lst in personList" :value="lst.userId" :key="lst.userId">{{lst.username}}</option>
            </select>
        </div>
    </div>
</template>

<script>
export default {
    props: ["DeptId"],
    data() {
        return {
            personList: []
        };
    },
    mounted(){
        // this.getSelDutyPerson()
    },
    watch:{
        DeptId () {
            // console.log(this.DeptId);
            this.getSelDutyPerson();
        }

    },
    methods:{
        getSelDutyPerson() {
            this.$api.ticket.list.selDutyPerson({
                deptId: this.DeptId
            }).then(res => {
                if (res.success) {
                    this.personList=res.data
                    // console.log(res);
                }
            });
        },
    }
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.control-label {
    padding: 0;
    line-height: 34px;
    text-align: right
}
input,
select,
textarea {
    border-radius: 5px;
}
.fa-asterisk{
    font-size: 1px;
    color: red
}
</style>
